////
////  CYasyn2synTests.m
////  CYTool
////
////  Created by baidu on 7/8/16.
////  Copyright © 2016 caoyuan02. All rights reserved.
////
//
//#import <XCTest/XCTest.h>
//#import "CYTool.h"
//@interface CYasyn2synTests : XCTestCase
//
//@end
//
//@implementation CYasyn2synTests
//
//- (void)testFromMainThread {
//    NSString *str =  CAOYUAN_ASYN_TO_SYN(^void(ReturnBlock returnBlock) {
//        [self asyncMethod:^(NSString *str) {
//            returnBlock(str);
//        }];
//    });
//    XCTAssertEqual(str, @"from asyn");
//}
//
//
//
//- (void)testFromSubThread {
//    __block NSString *str = nil;
//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//        str =  CAOYUAN_ASYN_TO_SYN(^void(ReturnBlock returnBlock) {
//            [self asyncMethod:^(NSString *str) {
//                returnBlock(str);
//            }];
//        });
//        dispatch_async(dispatch_get_main_queue(), ^{
//            XCTAssertEqual(str, @"from asyn");
//        });
//    });
//}
//
//- (void)testFromMainThreadWithParamsOutOfOutTime {
//    NSString *str = nil;
//    str = CAOYUAN_ASYN_TO_SYN_WITH_OUTTIME_DEFAULT_VALUE(^(ReturnBlock returnBlock) {
//        [self asyncMethod:^(NSString *str) {
//            returnBlock(str);
//        }];
//    }, 6, @"hello_world_default_value");
//    NSLog(@"🌞👉%@👈🌞",[NSString stringWithFormat:@"%@", str]);
//    XCTAssertEqual(str, @"from asyn");
//    
//}
//
//- (void)testFromMainThreadWithParamsInOutTime {
//    NSString *str = nil;
//    str = CAOYUAN_ASYN_TO_SYN_WITH_OUTTIME_DEFAULT_VALUE(^(ReturnBlock returnBlock) {
//        [self asyncMethod:^(NSString *str) {
//            returnBlock(str);
//        }];
//    }, 2, @"hello_world_default_value");
//    NSLog(@"🌞👉%@👈🌞",[NSString stringWithFormat:@"%@", str]);
//    XCTAssertEqual(str, @"hello_world_default_value");
//    
//}
//
//#pragma mark private method for testing
//- (NSString *)asyncMethod:(void(^)(NSString *str))block {
//    __block NSString *str = nil;
//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//        sleep(5);
//        str = @"from asyn";
//        block(str);
//    });
//    return str;
//}
//
//@end
